package com.hbsi.annotationDemo1;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author 程奕红
 * @version 1.0
 */
public class TestAnnotation3 {
    public static void main(String[] args) {
        Class c1= SuperMarket.class;
        if(c1.isAnnotationPresent(Description.class)){
            Description description=(Description) c1.getAnnotation(Description.class);
            System.out.println(description.value());
            System.out.println(description.goods().length+""+ Arrays.toString(description.goods()));
        }
        System.out.println("=================================");
        Method[] methods=c1.getMethods();
        for(Method method:methods){
            if(method.isAnnotationPresent(Description.class)){
                Description desMethod=method.getAnnotation(Description.class);
                System.out.println(desMethod.value());
                System.out.println(desMethod.goods().length+""+Arrays.toString(desMethod.goods()));
            }
        }
    }
}
